import {MenuModel} from "/@/api/system/model/MenuModel";
import axios from "/@/utils/http/axios";
import {MethodEnum} from "/@/utils/http/axios/enum/method-enum";
import {DictDataModel, DictQueryModel, DictTypeModel} from "/@/api/system/model/DictModel";
import {PageModel} from "/@/api/system/model/CommonModel";

/**
 * 插入字典
 * @param isHint
 * @param callBack
 */
export function insertDictType(data: DictTypeModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/system/dict/type/insertDictType", MethodEnum.POST, data, {callBack});
}
/**
 * 修改字典
 * @param isHint
 * @param callBack
 */
export function updateDictType(data: DictTypeModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/system/dict/type/updateDictType", MethodEnum.POST, data, {callBack});
}
/**
 * 分页获取字典数据
 * @param isHint
 * @param callBack
 */
export function listDictTypePage(data: DictQueryModel,callBack?: Function):Promise<PageModel<DictTypeModel[]>> {
    return axios.httpRequest("/system/dict/type/listDictTypePage", MethodEnum.GET, data, {callBack});
}


/**
 * 根据字典类型id删除字典
 * @param dictTypeId
 * @param callBack
 */
export function deleteDictTypeByDictTypeId(dictTypeId: string,callBack?: Function):Promise<PageModel<DictTypeModel[]>> {
    return axios.httpRequest("/system/dict/type/deleteDictTypeByDictTypeId", MethodEnum.GET, {dictTypeId}, {callBack});
}

/**
 * 根据字典类型id查询字典数据
 * @param dictTypeId
 * @param callBack
 */
export function selectDictTypeByDictTypeId(dictTypeId: string,callBack?: Function):Promise<PageModel<DictTypeModel[]>> {
    return axios.httpRequest("/system/dict/type/selectDictTypeByDictTypeId", MethodEnum.GET, {dictTypeId}, {callBack});
}

/**
 * 根据字典类型编号查询字典数据列表
 * @param data
 * @param callBack
 */
export function listDictDataByDictTypeCode(dictTypeCode: string,callBack?: Function):Promise<DictDataModel[]> {
    return axios.httpRequest("/system/dict/data/listDictDataByDictTypeCode", MethodEnum.GET, {dictTypeCode}, {callBack});
}

/**
 * 根据字典类型编号查询缓存字典数据列表
 * @param data
 * @param callBack
 */
export function listCacheDictDataByDictTypeCode(dictTypeCode: string,callBack?: Function):Promise<DictDataModel[]> {
    return axios.httpRequest("/system/dict/data/listCacheDictDataByDictTypeCode", MethodEnum.GET, {dictTypeCode}, {callBack});
}

/**
 * 清理字典缓存
 * @param dictTypeCode
 * @param callBack
 */
export function clearCacheByDictTypeCode(dictTypeCode: string,callBack?: Function):Promise<DictDataModel[]> {
    return axios.httpRequest("/system/dict/data/clearCacheByDictTypeCode", MethodEnum.GET, {dictTypeCode}, {callBack});
}